package main

import (
	"encoding/json"
	"fmt"
)

type Movie struct {
	Title string `json:"title"`
	Year  int    `json:"year"`
	Price int    `json:"price"`
}

func main() {
	movie := Movie{"mm", 2000, 100}
	jsonStr, err := json.Marshal(movie)
	if err != nil {
		fmt.Println("json marshal error")
		return
	}
	fmt.Printf("json = %s\n", jsonStr)

	myMovie := Movie{}
	err = json.Unmarshal(jsonStr, &myMovie)
	if err != nil {
		fmt.Println("json unMarshal error")
		return
	}
	fmt.Printf("move = %v\n", myMovie)
}
